﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Collections.ObjectModel;

namespace Delay
{
    public class BibleView : DependencyObject, INotifyPropertyChanged
    {
        public BibleView()
        {
            _poneBibleViewItems = new ObservableCollection<PhoneInfoCenterItem>();
        }
           
        private ObservableCollection<PhoneInfoCenterItem> _poneBibleViewItems;
        public ObservableCollection<PhoneInfoCenterItem> PoneBibleViewItems
        {
            get
            {
                return _poneBibleViewItems;
            }
            set
            {
                if (_poneBibleViewItems != value)
                {
                    _poneBibleViewItems = value;
                    NotifyPropertyChanged("PoneBibleViewItems");
                }
            }
        }
        private int _result;
        public int Result
        {
            get
            {
                return _result;
            }
            set
            {
                if (_result != value)
                {
                    _result = value;
                    NotifyPropertyChanged("Result");
                }
            }
        }
        //是否允许追加内容的开关
        public bool AllowAdd
        {
            get;
            set;
        }
        public int CurrentPage
        {
            get;
            set;
        }
        public int TotalPage
        {
            get;
            set;
        }
        public int PageSize
        {
            get;
            set;
        }
        public ProgressBar  prg
        {
            get;
            set;
        }
        public string ClassNmae
        {
            get;
            set;
        }
        public string GetPhoneInfoUrl(int p, int bibleType,string pid)
        {
            //Debug.WriteLine("class name is {0}",this);
             string url;
            url = QueryXml.PhoneTypeBibleUrl;
            url += ("imei=" + QueryXml.imei);
            url += ("&phonename=" + QueryXml.phonename);
            url += ("&phonevs=" + QueryXml.phonevs);
            url += ("&phonevsno=" + QueryXml.phonevsno);
            url += ("&keyvalue=" + QueryXml.keyvalue);
            url += ("&channelkey=" + QueryXml.channelkey);
            url += ("&pid=" + pid);
            url += ("&p=" + p.ToString());
            url += ("&total=" + TotalPage.ToString());
            url += ("&pagesize=" + PageSize.ToString());
            url += ("&category=" + bibleType.ToString());
            return url;
        }
        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
